# -*- coding: utf-8 -*-
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import sys

if 'lib' not in sys.path:
    # Add /lib as primary libraries directory, with fallback to /distlib
    # and optionally to distlib loaded using zipimport.
    sys.path[0:0] = ['lib', 'distlib', 'distlib.zip']

import config
import tipfy

from apps.pf_mobile import wsgi

# Is this the development server?
debug = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')


# Instantiate the application.
tipfy.Tipfy.request_class = wsgi.MobileRequest
tipfy.Tipfy.response_class = wsgi.MobileResponse  
app = tipfy.make_wsgi_app(config=config.config, debug=debug)


def main():
    app.run()


if __name__ == '__main__':
    main()
